//
//  MXFooderRecordCell.m
//  HNBaseProject
//
//  Created by xujie on 2024/6/4.
//

#import "MXFooderRecordCell.h"

@implementation MXFooderRecordCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createUI];
    }
    return self;
}

- (void)createUI {
    self.selectionStyle = 0;
    self.backgroundColor = [UIColor colorWithHexString:@"#f8f8f8"];
    
    self.bgView = [[UIView alloc] initWithFrame:CGRectMake(25, 15, kScreenW-50, 55)];
    self.bgView.backgroundColor = [UIColor whiteColor];
    self.bgView.layer.cornerRadius = 10;
    self.bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:self.bgView];
    
    self.dotV = [[UIView alloc] init];
    self.dotV.backgroundColor = [UIColor colorWithHexString:@"#f8f8f8"];
    self.dotV.layer.cornerRadius = 7;
    self.dotV.layer.masksToBounds = YES;
    [self.bgView addSubview:self.dotV];
    [self.dotV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(20);
        make.centerY.mas_equalTo(self.bgView);
        make.height.width.mas_equalTo(14);
    }];
    
    self.timeLab = [[UILabel alloc] init];
//    self.timeLab.text = @"2024.04.27 01:29";
    self.timeLab.textColor = [UIColor colorWithHexString:@"#000000"];
    self.timeLab.font = PFRFont(14);
    [self.bgView addSubview:self.timeLab];
    [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.bgView);
        make.left.offset(45);
    }];
    
    self.countLab = [[UILabel alloc] init];
    self.countLab.text = @"喂食2份";
    self.countLab.textColor = [UIColor dc_colorWithHexString:@"#000000" alpha:0.7];
    self.countLab.font = PFRFont(14);
    [self.bgView addSubview:self.countLab];
    [self.countLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.bgView);
        make.right.offset(-20);
    }];
}

- (void)reloadCellWithModel:(MXFooderPlanDetailModel *)model {
    self.timeLab.text = model.outTime;
    self.countLab.text = [NSString stringWithFormat:@"喂食%@份",SAFEPARAMETER(model.outCopies)];
}

@end
